﻿using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Resources;

namespace WaveringLand_Launcher.Helper
{
    public static class TipHelper
    {
        public static List<string> Tips = new List<string>();

        static TipHelper()
        {
            Uri uri = new Uri("/Res/tips.txt", UriKind.Relative);
            StreamResourceInfo info = App.GetResourceStream(uri);
            StreamReader sr = new(info.Stream);
            var line = sr.ReadLine();
            while(line != null)
            {
                Tips.Add(line);
                line = sr.ReadLine();
            }
            sr.Close();
        }

        public static string GetRandomTip()
        {
            return Tips[new Random().Next(Tips.Count)];
        }

        public static void ShowRandomTipWindow()
        {
            MessageBoxX.Show(App.Current.MainWindow,"你知道吗:" + GetRandomTip(), "你知道吗", MessageBoxButton.OK);
        }
    }
}
